<?php defined('ByShopWWI') or exit('Access Invalid!');?>
<?php if(!empty($output['goodsevallist']) && is_array($output['goodsevallist'])){?>
    <?php foreach($output['goodsevallist'] as $k=>$v){?>

<div id="t" class="ncs-commend-floor" style="margin: 20px auto 0;width: 90%;position: relative;">
  <div class="user-avatar"> <a <?php if($v['geval_isanonymous'] != 1){?>href="" target="_self" data-param="{'id':<?php echo $v['geval_frommemberid'];?>}"  <?php }?>> <img src="<?php echo getMemberAvatarForID($v['geval_frommemberid']);?>"> </a> </div>
  <dl class="detail">
    <dt> <span class="user-name">

      <?php if($v['geval_isanonymous'] == 1){?>
          <?php echo str_cut($v['geval_frommembername'],2).'***';?>
      <?php }else{?>
          <?php echo $v['geval_frommembername'];?>
      <?php }?>
      </span>
                <div class="goods-raty">商品评分：<em class="raty" data-score="<?php echo $v['geval_scores'];?>"></em></div>
                </dt>
                <dd><?php echo $v['geval_content'];?></dd>
                <?php if(!empty($v['geval_image'])) {?>
                    <dd>
                        <ul class="photos-thumb">
                            <?php $image_array = explode(',', $v['geval_image']);?>
                            <?php foreach ($image_array as $value) { ?>
                                <li><a nctype="nyroModal"  href="<?php echo snsThumb($value, 1024);?>"> <img src="<?php echo snsThumb($value);?>"> </a></li>
                            <?php } ?>
                        </ul>
                    </dd>
                <?php } ?>
                <dd class="pubdate" pubdate="pubdate" style="position:relative;">


                    <?php echo @date('Y-m-d H:i:s',$v['geval_addtime']);?>

                    <div style="position: absolute; right: 0;top: 0px;">
                        <a href="javascript:void(0);" data-id="<?php echo $v['geval_id'];?>" class="zan">点赞</a>

                        (<span><?php
                            if ($v['geval_count']){
                                echo $v['geval_count'];
                            }else{
                                echo '0';
                            }

                            ?></span>)

                    </div>


                </dd>
                <?php if (!empty($v['geval_explain'])){?>
                    <dd class="explain"><?php echo $lang['nc_credit_explain'];?>：<?php echo $v['geval_explain'];?></dd>
                <?php } ?>
                <?php if ($v['geval_content_again'] != '') {?>
                    <dd>[追加评价]&nbsp;<?php echo $v['geval_content_again'];?></dd>
                    <?php if(!empty($v['geval_image_again'])) {?>
                        <dd>
                            <ul class="photos-thumb">
                                <?php $image_array = explode(',', $v['geval_image_again']);?>
                                <?php foreach ($image_array as $value) { ?>
                                    <li><a nctype="nyroModal"  href="<?php echo snsThumb($value, 1024);?>"> <img src="<?php echo snsThumb($value);?>"> </a></li>
                                <?php } ?>
                            </ul>
                        </dd>
                    <?php } ?>
                    <dd class="pubdate">确认收货并评价后<?php echo ($d = floor($v['geval_addtime_again']/ 60 / 60 / 24) - floor($v['geval_addtime']/ 60 / 60 / 24)) == 0? '当' : $d;?>天再次追加评价</dd>
                    <?php if (!empty($v['geval_explain_again'])){?>
                        <dd class="explain"><?php echo $lang['nc_credit_explain'];?>：<?php echo $v['geval_explain_again'];?></dd>
                    <?php } ?>
                <?php }?>
                <hr/>
            </dl>




        </div>
    <?php }?>
    <div class="tr pr5 pb5 pr">
        <div class="pagination"> <?php echo $output['show_page'];?></div>
    </div>
<?php }else{?>
    <div class="ncs-norecord"><?php echo $lang['no_record'];?></div>
<?php }?>
<script type="text/javascript">
    $(document).ready(function(){
        $('.raty').raty({
            path: "<?php echo RESOURCE_SITE_URL;?>/js/jquery.raty/img",
            readOnly: true,
            score: function() {
                return $(this).attr('data-score');
            }
        });

        $('a[nctype="nyroModal"]').nyroModal();

        $('#goodseval').find('.demo').ajaxContent({
            event:'click', //mouseover
            loaderType:"img",
            loadingMsg:"<?php echo SHOP_TEMPLATES_URL;?>/images/transparent.gif",
            target:'#goodseval'
        });
    });


    $(".zan").click(function(){
        var id=$(this).data("id")
        var i = $(this).siblings("span")
        $.ajax({
            type : "POST", //提交方式
            url : "<?php echo urlShop('goods', 'zan');?>",//路径
            data : {
                "geval_id" : id
            },//数据，这里使用的是Json格式进行传输
            success : function(result) {//返回数据根据结果进行相应的处理
                if(result === "1"){
                    showDialog('请先登录再点赞', 'notice','','','','','','','','',2);
                }
                if(result === "2"){
                    i.text((i.text()*1)+1)
                    showDialog('点赞成功', 'succ','','','','','','','','',2);
                }
                if(result === "3"){
                    showDialog('已点赞,请勿重复点击！', 'notice','','','','','','','','',2);
                }
            }
        });

});



    function GetQueryString(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }
</script> 
